<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_access_log', function (Blueprint $table) {
            $table->id()->startingValue(10);
            $table->string('path',255)->default('')->comment('访问地址');
            $table->integer('user_id')->default(0)->unsigned()->comment('用户ID');
            $table->string('account',255)->default('')->comment('用户name');
            $table->string('menu_path',255)->default('')->comment('菜单路径');
            $table->string('ip',255)->default('')->comment('访问Ip');
            $table->tinyInteger('status')->default(0)->comment('状态:1=正常,2=禁用');
            $table->integer('created_at')->default(0)->unsigned()->comment('创建时间');
            $table->string('method',10)->default('')->comment('请求方式');
            $table->string('browser',100)->default('')->comment('browser');
            $table->string('action',100)->default('')->comment('action');
            $table->json('params')->comment('params');
            $table->json('result')->comment('result');
            $table->string('region',255)->default('')->comment('地区');
        });
        DB::statement("ALTER TABLE `admin_access_log` comment '【后台】操作日志'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_access_log');
    }
};
